package com.gw.yunke.interceptor;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import java.io.PrintWriter;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author: zoulei
 * @date: 2018/1/8
 * @description:
 */
//@Component
public class LoginInterceptor implements HandlerInterceptor {

  public static final Logger logger = LoggerFactory.getLogger(LoginInterceptor.class);


  @Override
  public boolean preHandle(HttpServletRequest httpServletRequest,
                           HttpServletResponse httpServletResponse, Object o) throws Exception {

    return true;
  }

  @Override
  public void postHandle(HttpServletRequest httpServletRequest,
                         HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView)
      throws Exception {
    // String url = httpServletRequest.getRequestURL().toString();
    // String method = httpServletRequest.getMethod();
    // String uri = httpServletRequest.getRequestURI();
    // String queryString = httpServletRequest.getQueryString();
    // System.out.println(httpServletRequest.getParameterMap());
    System.out.println("postHandle");
  }

  @Override
  public void afterCompletion(HttpServletRequest httpServletRequest,
                              HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
    System.out.println("afterCompletion");
  }
}
